package top.boycharse.blog.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import top.boycharse.blog.dao.bean.User;
import top.boycharse.blog.dao.service.UserService;

@RestController
public class TestController {

    @Autowired
    private UserService userService;

    @GetMapping("/test")
    public String test() {
        return "success";
    }

    @GetMapping("/test/user")
    public String testUser() {
        User user = userService.getUserByUserName("wangyuyong");
        if (user == null) {
            return "null";
        }else {
            return "not null";
        }
    }

    @GetMapping("/admin")
    public String admin() {
        return "测试成功！";
    }
}
